<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="css/table.css" rel="stylesheet" type="text/css" />
<link href="css/excite-bike/jquery-ui-1.8.22.custom.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="js/jquery-ui-1.8.22.custom.min.js"></script>
<script src="js/widgets.js"></script>
<script type="text/javascript">

function Click_Reset() {
 	$.each($(".require_from_group"), function(i, val) { //將每個欄位都設為空字串
		val["value"] = "";
	});
	$("#q_message").html("");	//效果不太一樣，頂著先
	$("#square").css("visibility", "hidden");
}

$(document).ready(function() {
	$("#sub_tpOwnerList")[0].value ="";
	$("#dialog-Group").css("visibility", "hidden");
	$("button").button();
	$("#square").css("visibility", "hidden");
	$("#reportRes").css("visibility", "hidden");
	$("input[id$=Date]").datepicker({
		dateFormat : "yy-mm-dd"
	});
});

function moving(tpid,tpName){
	$("#sub_tpid")[0].value = tpid;
	x = $("#q_form").serializeArray();
	$("#reportTitle").html(tpName);
	var date= df(4);
	$("#reportTime").html(date);
	$("#testReportBody tr").remove();
	$.ajax({
		type : "post",
		url : "GenTestReport",
		data : x,
		dataType : "JSON",
		success : function(queryResult) {
			var kNum =0;
			var sNum =0;
			var fNum =0;
			var cNum =0;
			var wNum =0;
			$.each(	queryResult.sqlData,function(i,res) {
				var bgcolor="#CCCCCC";
				if ((i+1) % 2 ==1) { bgcolor="#FFFFFF"; }
				$("#testReportBody").append(
					"<tr bgcolor=\""+bgcolor+"\"><td>"
					+ (i+1)
					+ "</td><td>"
					+ res.sourceid
					+ "</td><td>"
					+ res.mrdescription
					+ "</td><td class='right'>"
					+ res.keypointNum
					+ "</td><td class='right'>"
					+ res.succNum
					+ "</td><td class='right'>"
					+ res.failNum
					+ "</td><td class='right'>"
					+ res.cantNum
					+ "</td><td class='right'>"
					+ res.waitNum
					+ "</td><td>"
					+ ""
					+ "</td></tr>");
				
				kNum += parseInt(res.keypointNum,10);
				sNum += parseInt(res.succNum,10);
				fNum += parseInt(res.failNum,10);
				cNum += parseInt(res.cantNum,10);
				wNum += parseInt(res.waitNum,10);
			});

			$("#testReportBody").append(
					"<tr><td></td><td></td><td></td><th class='query'>"
					+ kNum
					+ "</th><th class='query'>"
					+ sNum
					+ "</th><th class='query'>"
					+ fNum
					+ "</th><th class='query'>"
					+ cNum
					+ "</th><th class='query'>"
					+ wNum
					+ "</th><td>"
					+ ""
					+ "</td></tr>");
			
			$("#reportRes").css("visibility", "visible");
			$("#reportRes").dialog({
				resizable : true,
				width : 700,
				height : 700,
				modal : true,
				buttons : {
					"關閉" : function() {
						$(this).dialog("close");
					}
				}
			});
		}
	});
}

</script>

</head>
<body>

	<form id="q_form" method="post">
		<table>
			<tr>
				<th colspan="2" valign="middle" scope="col">請輸入查詢條件</th>
			</tr>
			<tr>
				<th valign="middle" scope="col">
					<div align="right">計劃編號：</div>
				</th>
				<td scope="col"><div align="left">
						<input type="text" name="q_tpID" id="q_tpID"
							class="require_from_group" />
					</div></td>
			</tr>
			<tr>
				<th valign="middle"><div align="right">計劃名稱：</div></th>
				<td bgcolor="#CCCCCC"><input type="text" name="q_tpName"
					id="q_tpName" class="require_from_group" /></td>
			</tr>
			<tr>
				<th valign="middle"><div align="right">計畫案負責人：</div></th>
				<td>
				<button type="button" id="tdTPOwner" onClick="pickAllStaff('tpOwner')">選擇</button><ul id="tpOwner"></ul>
				
				</td>
			</tr>
			<tr>
				<th rowspan="2" valign="middle"><div align="right">建立日期：</div>
					<div align="right"></div></th>
				<td bgcolor="#CCCCCC">起：<input type="text" name="q_cfromDate"
					id="q_cfromDate" class="require_from_group" />
				</td>
			</tr>
			<tr>
				<td>迄：<input type="text" name="q_ctoDate" id="q_ctoDate"
					class="require_from_group" />
				</td>
			</tr>
			<tr>
				<th rowspan="2" valign="middle"><div align="right">最後修改日期：</div></th>
				<td bgcolor="#CCCCCC">起：<input type="text" name="q_ufromDate"
					id="q_ufromDate" class="require_from_group" />
				</td>
			</tr>
			<tr>
				<td>迄：<input type="text" name="q_utoDate" id="q_utoDate"
					class="require_from_group" />
				</td>
			</tr>
			<tr>
				<th>&nbsp;</th>
				<td bgcolor="#CCCCCC">
					<button type="button" id="clickS" onClick="Click_QueryTP('2')">送出查詢</button>
					<button type="button" id="clickReset" onClick="Click_Reset()">重設</button>
				</td>
			</tr>
			<tr>
				<th>&nbsp;</th>
				<td id="q_message" class="require_from_group">&nbsp;</td>
			</tr>
		</table>
		
		<input type="hidden" id="sub_tpOwnerList" name="tpOwnerList" />			<!-- 測試案負責人 -->
		<input type="hidden" id="sub_tpid" name="tpid" />
		<input type="hidden" id="sub_er" name="er" />							<!-- 要查詢的後端角色為 -->
	</form>
	<div id="square">
		<p>&nbsp;</p>
		<h2 id="ReaultNum"></h2>
		<hr />

		<table id="resultTable">
			<thead id="resultTable_h">
				<tr>
					<th>#</th>
					<th>計畫案名稱</th>
					<th>&nbsp;</th>
				</tr>
			</thead>

			<tbody id="resultTable_b">
			</tbody>
		</table>
	</div>
<div id="reportRes" title="測試報告">
	<table>
	<thead>
	<tr><th colspan="2" class="query">計劃案名稱：</th><td colspan="7" id="reportTitle"></td></tr>
	<tr><th colspan="2" class="query">日期時間：</th><td colspan="7" id="reportTime"></td></tr>
	<tr><th colspan="2" class="query">專案狀態：</th><td colspan="7" id="reportStatus"></td></tr>
	<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
	<tr><th colspan="9" >測試執行狀態</th></tr>
	<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
	<tr><th>#</th><th>表單編號</th><th>作業功能</th><th>驗證重點數</th><th>成功數</th><th>失敗數</th><th>不可執行數</th><th>尚未完成數</th><th>備註</th></tr>
	</thead>
	<tbody id="testReportBody">
	</tbody>
	<tfoot>
	<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
	<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
	<tr><th colspan="9" class="center">障礙分布 & 議題清單</th></tr>
	<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
	</tfoot>		
	</table>
</div>

	<div id="dialog-Group" title="請勾選人員">
		<table>
			<thead>
				<tr>
					<th><input type="checkbox" id="tpoCheckALL" onClick="chkALL('tpo')"/></th>
					<th>#</th>
					<th>人員列表</th>
				</tr>
			</thead>
			
			<tbody id="tBodyTPOwner">
			
			</tbody>
		</table>
	</div>



</body>
</html>